home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / gamesmaster / demosrc / agafade.s < prev    next >
Text File  |  1996-07-16  |  4KB  |  134 lines

  1. ;AGA Picture
  2. ;-----------
  3. ;Fades in a 32 colour AGA picture (24 bit colour).  And then fades it out.
  4. ;
  5. ;Press left mouse button to exit.
  6.  
  7.     opt    o+
  8.  
  9.     INCLUDE    "exec/exec_lib.i"
  10.     INCLUDE    "games/games_lib.i"
  11.     INCLUDE    "games/games.i
  12.  
  13. CALL    MACRO
  14.     jsr    _LVO\1(a6)
  15.     ENDM
  16.  
  17. LOCAL    =    0
  18.  
  19.     SECTION    "AGA_Screen",CODE
  20.  
  21. ;===========================================================================;
  22. ;                             INITIALISE DEMO
  23. ;===========================================================================;
  24.  
  25. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  26.     move.l    ($4).w,a6
  27.     lea    GMS_Name(pc),a1
  28.     moveq    #$00,d0
  29.     CALL    OpenLibrary
  30.     move.l    d0,GMS_Base
  31.     beq.s    Quit
  32.  
  33.     move.l    GMS_Base(pc),a6          ;Initialise our screen.
  34.     lea    ScreenStruct(pc),a0     
  35.     CALL    Add_Screen
  36.     tst.l    d0
  37.     bne.s    Error
  38.  
  39.     move.l    SS_MemPtr1(a0),a1        ;Destination = SS_MemPtr1.
  40.     lea    PackedPicFile(pc),a0     ;File Name.
  41.     CALL    QuickLoad
  42.     tst.l    d0
  43.     beq.s    Error
  44.  
  45.     lea    ScreenStruct(pc),a0      ;Unpack the data on top of itself.
  46.     move.l    SS_MemPtr1(a0),a1
  47.     move.l    a1,a0
  48.     moveq    #$00,d0
  49.     CALL    SmartUnpack
  50.  
  51.     lea    ScreenStruct(pc),a0      ;Now show the screen/pic.
  52.     CALL    Show_Screen
  53.  
  54. ;===========================================================================;
  55. ;                                MAIN CODE
  56. ;===========================================================================;
  57.  
  58. .FadeIn    CALL    Wait_OSVBL
  59.     moveq    #1,d0                    ;d0 = Speed of fade.
  60.     lea    ScreenPalette(pc),a1
  61.     CALL    B24_FadeToPalette        ;Do the fade routine.
  62.     tst.w    d0                       ;Has the fade finished yet?
  63.     bne.s    .FadeIn                  ;If not, keep doing it.
  64.  
  65.     CALL    Wait_LMB
  66.  
  67. .FadeOut
  68.     CALL    Wait_OSVBL
  69.     moveq    #2,d0                    ;d0 = Speed of fade.
  70.     CALL    B24_FadeToBlack          ;Do the fade routine.
  71.     tst.w    d0                       ;Has the fade finished yet?
  72.     bne.s    .FadeOut                 ;If not, keep doing it.
  73.  
  74. ;===========================================================================;
  75. ;                              RETURN TO DOS
  76. ;===========================================================================;
  77.  
  78.     CALL    Delete_Screen            ;Give back screen memory etc.
  79. Error    move.l    ($4).w,a6
  80.     move.l    GMS_Base(pc),a1
  81.     CALL    CloseLibrary
  82. Quit    MOVEM.L    (SP)+,A0-A6/D1-D7
  83.     moveq    #$00,d0
  84.     rts
  85.  
  86. ;===========================================================================;
  87. ;                                  DATA
  88. ;===========================================================================;
  89.  
  90. GMS_Name:
  91.     dc.b    "games.library",0
  92.     even
  93. GMS_Base:
  94.     dc.l    0
  95.  
  96. AMT_PLANES =    5
  97.  
  98. ScreenStruct:
  99.     dc.l    "GSV1"
  100.     dc.l    0,0,0                    ;Screen_Mem1/2/3
  101.     dc.l    0                        ;Screen link.
  102.     dc.l    0 ;ScreenPalette         ;Address of palette.
  103.     dc.l    0                        ;Address of rasterlist.
  104.     dc.l    0                        ;Amt of colours in palette.
  105.     dc.w    256,320,320/8            ;Screen Height, Width, Width/8
  106.     dc.w    256,320,320/8            ;Pic Height, Width, Width/8
  107.     dc.w    AMT_PLANES               ;Amt of planes.
  108.     dc.w    0,0                      ;Top of screen offsets, X/Y
  109.     dc.w    0                        ;Scroll buffer in pixels/8.
  110.     dc.w    0,0                      ;X/Y counters (for scrolling).
  111.     dc.l    NOBURST                  ;Special attributes.
  112.     dc.w    LORES|_24BITCOL          ;Screen mode.
  113.     dc.b    INTERLEAVED              ;Screen type
  114.     dc.b    0                        ;Screen Is Being Displayed?
  115.     dc.l    0,0                      ;Reserved area.
  116.     even
  117.  
  118. ScreenPalette:
  119.     dc.l    $000000,$080808,$101010,$191919
  120.     dc.l    $212121,$292929,$313131,$3A3A3A
  121.     dc.l    $424242,$4A4A4A,$525252,$5A5A5A
  122.     dc.l    $636363,$6B6B6B,$737373,$7B7B7B
  123.     dc.l    $848484,$8C8C8C,$949494,$9C9C9C
  124.     dc.l    $A5A5A5,$ADADAD,$B5B5B5,$BDBDBD
  125.     dc.l    $C5C5C5,$CECECE,$D6D6D6,$7F7F7F
  126.     dc.l    $9B9B9B,$707070,$444444,$1E1E1E
  127.  
  128. PackedPicFile:
  129.     IFNE    LOCAL
  130.     dc.b    "GAMESLIB:Demos/"
  131.     ENDC
  132.     dc.b    "data/AGAPic32.pak",0
  133.     even
  134.